home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group96b.txt / 000056_icon-group-sender _Thu Nov 14 01:24:50 1996.msg < prev    next >
Internet Message Format  |  1997-01-02  |  3KB

  1. Received: by cheltenham.cs.arizona.edu; Thu, 14 Nov 1996 09:13:28 MST
  2. To: icon-group@cs.arizona.edu
  3. Date: 14 Nov 1996 01:24:50 GMT
  4. From: haertel@ichips.intel.com (Mike Haertel)
  5. Message-Id: <56dsd2$7mq@news.jf.intel.com>
  6. Organization: Intel Corporation
  7. Sender: icon-group-request@cs.arizona.edu
  8. Subject: A bug fix (workaround, really) for ICONC with large integers
  9. Errors-To: icon-group-errors@cs.arizona.edu
  10.  
  11. The Unix Icon compiler has a long-standing bug that array indexing
  12. doesn't work when large integers are enabled.  I reported this a long
  13. time ago but nobody ever did anything about it, and I got tired of
  14. waiting.  I don't see an Icon mailing list on the web page, so here
  15. it is...
  16.  
  17. SYMPTOM:
  18.  
  19.     The following program doesn't compile with "iconc -fl foo.icn";
  20.     it gets a type error from the C compiler.  (You won't see this
  21.     error unless you're using a compiler that supports prototypes,
  22.     like GCC.)
  23.  
  24.     procedure main(argl)
  25.         every i := 1 to *argl do
  26.             write(argl[i])
  27.     end
  28.  
  29. PATCH:
  30.  
  31.     There is a bug in Iconc's inlining of the runtime library
  32.     code that causes it to generate calls to the runtime array
  33.     indexing function with the an argument of the wrong C type.
  34.  
  35.     The following patch works around the bug by changing the
  36.     runtime code.  It does not address the underlying Iconc bug,
  37.     which might conceivably affect inlining other parts of the
  38.     runtime as well.  I think I know where the underlying bug
  39.     is, but it's not obvious to me how to fix it and I just want
  40.     to get some work done...
  41.  
  42. CAVEATS:
  43.  
  44.     After applying this patch you'll have to rebuild rt.a and
  45.     rt.db.  As usual where random patches from strangers are
  46.     concerned, your milage may vary. :-)
  47.  
  48. --- dist/src/runtime/oref.r    Thu Sep 28 10:46:45 1995
  49. +++ src/runtime/oref.r    Tue Nov 12 23:32:46 1996
  50. @@ -560,10 +560,10 @@
  51.       runerr(101, i)
  52.       }
  53. -      if !cnv:C_integer(j) then {
  54. +      else if !cnv:C_integer(j) then {
  55.           if cnv : integer(j) then inline { fail; }
  56.       runerr(101, j)
  57.           }
  58.  
  59. -      body {
  60. +      else body {
  61.           C_integer t;
  62.  
  63. @@ -613,10 +613,10 @@
  64.       runerr(101, i)
  65.       }
  66. -      if !cnv:C_integer(j) then {
  67. +      else if !cnv:C_integer(j) then {
  68.           if cnv : integer(j) then inline { fail; }
  69.       runerr(101, j)
  70.           }
  71.  
  72. -      body {
  73. +      else body {
  74.           C_integer t;
  75.  
  76. @@ -667,5 +667,5 @@
  77.          runerr(101, y)
  78.          }
  79. -         body {
  80. +         else body {
  81.              word i, j;
  82.              register union block *bp; /* doesn't need to be tended */
  83. @@ -825,5 +825,5 @@
  84.          }
  85.  
  86. -         body {
  87. +         else body {
  88.              char ch;
  89.              word i;
  90.